package com.seed.web.core;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.interceptor.ServletRequestAware;

import com.opensymphony.xwork2.ActionSupport;

/**
 * 说明： 所有Action类继承该类 集成了日志处理,数据字典解析等 <br/>
 * 编写者：杨浩泉 <br/>
 * 日期：2010-3-1
 */
public class BaseActionSupport extends ActionSupport implements ServletRequestAware {

	private static final long serialVersionUID = 1L;

	protected transient final Log log = LogFactory.getLog(getClass());

	@Resource
	private BaseForm baseform;

	protected void saveMessage(String msg) {
		/*List<Object> messages = (List<Object>) this.baseform.getRequest().getSession().getAttribute("messages");
		if (messages == null) {
			messages = new ArrayList<Object>();
		}
		messages.add(msg);*/
		this.baseform.getRequest().setAttribute("messages",msg);
	}

	public BaseForm getBaseform() {
		return baseform;
	}

	public void setBaseform(BaseForm baseform) {
		this.baseform = baseform;
	}

	@Override
	public void setServletRequest(HttpServletRequest request) {
		this.baseform.setRequest(request);
	}

}
